.\" -*- nroff -*-
.TH pcibios_find_class 9 "August 5, 1997" "Linux DDI" "BIOS32 Functions"
.hlm 0
.na
.SH NAME
pcibios_find_class, pcibios_find_device \- find a PCI class or device
.SH SYNOPSIS
.B #include  <linux/bios32.h>
.sp
.TP
.BI "int pcibios_find_class(unsigned int " class_code \
", unsigned short " index ", unsigned char* " bus \
", unsigned char* " device_fn ");"
.TP
.BI "int pcibios_find_device(unsigned\ short\ "\ vendor \
", unsigned\ short\ " device_id\ \
", unsigned\ short\ " index ", unsigned\ char*\ " bus \
", unsigned\ char*\ " device_fn ");"
.hlm 1
.ad
.SH DESCRIPTION
The
.B pcibios_find_class
function searches for a certain class of device on the PCI bus.  In this
instance, class is used to represent a few different categories of
devices.  Some examples are storage, network, display, and memory
classes. The classes are defined by the PCI Specification, and the
.I class_code
is matched with the dword in the configuration space of the device at
offset 0x08.
.PP
The
.B pcibios_find_device
function finds a device on the PCI bus that has the matching device
and vendor ids. The vendor ids are assigned to the PCI Sig to vendors,
who in turn assign device ids to the devices they develop. The vendor
and device ids are encoded in dword 0x00 of the configuration space.
.PP
Both
.B pcibios_find_class
and
.B pcibios_find_device
include an extra
.I index
parameter, which is used to select the specific
device if there are multiple matches. An
.I index
of 0 matches the firts located board, 1 the second, and so on.
.PP
The
.I bus
and
.I device_fn
parameters are PCI specific cookies that are passed to other pcibios
functions to access the configuration space of the located device.
.SH "RETURN VALUE"
On success, the functions return
.IR PCIBIOS_SUCCESSFUL "."
Otherwise, one of the following error codes is returned:
.RS
.TP
PCIBIOS_DEVICE_NOT_FOUND
There is no device that matches the search criteria,
.TP
PCIBIOS_BAD_VENDOR_ID
The vendor id is invalid. (0xffff is not a valid id.)
.TP
PCIBIOS_FUNC_NOT_SUPPRTED
The PCI subsystem is not available
.RE
.SH AVAILABILITY
Linux 1.0+
.SH "SEE ALSO"
.BR pcibios_present "(9)"
.PP
.BR /usr/include/linux/pci.h ", "
.BR /usr/include/linux/bios32.h
.PP
.I "PCI Local Bus Specification"
.SH AUTHOR
Kirk Petersen (kirk@speakeasy.org)
.SH BUGS
